@model ICollection<CleverCMS.Cms.Data.Entities.Role>

@section TitleContent
{
    Roles
}

<div class="widget green">
    <div class="widget-title">
        <h4><i class="icon-reorder"></i> Roles</h4>
    </div>
    <div class="widget-body">
        @*<button class="btn btn-danger" id="DeleteAllButton"><i class="icon-remove icon-white"></i> Delete all selected</button>*@
        <a class="btn btn-warning" href="@Url.Action("Edit","Role", new { area = "CleverCms.Admin" })"><i class="icon-plus icon-white"></i> Create</a>
        <div id="jtable-div" style="margin-top: 5px;">
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('#jtable-div').jtable({
            paging: true,
            pageSize: 12,
            gotoPageArea: 'none',
            pageSizeChangeArea: false,
            sorting: true,
            defaultSorting: 'Name ASC',
            selecting: true,
            multiselect: true,
            selectingCheckboxes: true,
            selectOnRowClick: false,
            actions: {
                listAction: '@Url.Action("ListRoles","Role")',
               // deleteAction: '@Url.Action("Delete","Role")'
            },
            fields: {
                RoleId: {
                    key: true,
                    create: false,
                    edit: false,
                    list: true,
                    width: '5%'
                },
                RoleName: {
                    title: 'Name',
                    width: '90%'
                }@*,
                Edit: {
                    sorting: false,
                    title: 'Edit',
                    width: '1%',
                    display: function (data) {
                        return '<a href="@Url.Action("Edit")/' + data.record.RoleId + '">Edit</a>';
                    }
                }*@
            }
        });
        $('#jtable-div').jtable('load');
        
        //$('#DeleteAllButton').button().click(function () {
        //    var $selectedRows = $('#jtable-div').jtable('selectedRows');
        //    $('#jtable-div').jtable('deleteRows', $selectedRows);
        //});
    });
</script>